﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<easyccms.BusinessLayer.Entities.MenuItem>>" %>

      <div class="page-title ui-widget-content ui-corner-all">
        <div class="float-right">
        <%= Html.ActionLink("Add new","Create") %>         
        </div>
        <h1>
        
            <b>Menu Items Management</b></h1>
        <div class="other">
            <div class="hastable">
                <table id="Table1">
                    <thead>
                        <tr>
                            <th>
                                #
                            </th>
                            <th >
                                Name
                            </th>
                           
                            <th >MenuName</th>
                            <th >
                                User
                            </th>
                            <th >
                                Display until
                            </th>

                            <th>Locked out</th>
                            <th>Created</th>
                            <th >
                                ID
                            </th>
                            <th style="width: 100px">
                                Options
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <%
                            int i = 0;
                        %>
                        <% if (Model != null) foreach (var item in Model)
                           {
                               i++; 
                        %>
                        <tr <%= (i/2==0)?"class=\"even\"":"class=\"odd\"" %>>
                            <td>
                                <%= i++ %>
                            </td>
                            <td>                            
                           <%= item.Name%>
                            </td>
                            <td>
                            <%= item.Menu.Name %></td>
                            <td>
                                <%=
                string.Format("{0} {1}", item.User.UserProfile.Name, item.User.UserProfile.Surname)%>
                            </td>
                            <td>
                            <% if (item.DisplayUntil != null)
{ %>
                                <%=((DateTime) item.DisplayUntil).ToShortDateString()%>
                                <% } %>
                            </td>
                            <td>
                                <%= item.ItemOrder %>
                            </td>
                            <td><%= item.Created.ToShortDateString()%></td>
                            <td>
                                <%= item.MenuItemId %>
                            </td>
                            <td>
                                <%: Html.ActionLink("Restore", "BinRestore", new { id = item.MenuItemId })%>
                                |
                                <%: Html.ActionLink("Bin it", "BinDelete", new { id = item.MenuItemId })%>
                            </td>
                        </tr>
                        <% } %>
                    </tbody>
                </table>
            </div>
            <div class="clearfix">
            </div>
        </div>
    </div>